<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 扩展运算符 
        // 1. 拷贝数组
        let arr = [1, 2];
        let arr1 = [...arr];
        console.log(arr, arr1);
        console.log(arr === arr1);

        // 2. 合并数组
        console.log([...[1, 2], ...[3, 4]]); // [1, 2, 3, 4]

        // 3. 解构伪数组，转化为数组
        function add() {
            let arr = [...arguments];
            arr.push("张飞");
            console.log(arr);
        }
        add(1, 2, 3);
    </script>
</body>

</html>